feat(parser): structure MySQL DROP INDEX ... ON table (incl. db-qualified target) - #61
Merged
Merged
Conversation
…fied target)
MySQL `DROP INDEX idx ON tbl` degraded to a raw Command because the port had no
exp.OnProperty node for the ON-clause target, so parseDrop's ON branch fell back
to Command. This adds the OnProperty node and parses the ON target as a table:
DROP INDEX idx ON users -> Drop{kind:INDEX, this:Table(idx), cluster:OnProperty(Table(users))}
DROP INDEX idx ON db.users -> ... cluster:OnProperty(Table(users, schema:db))
Pinned upstream v30.12.0 structures the unqualified form (this closes that port
gap), but its shared _parse_on_property parses only a single id, so it parse-errors
the db-qualified `ON db.users` — which real MySQL 8.0.46 accepts. Parsing a full
table target here (scoped to DROP; CREATE/ALTER keep upstream's ON handling) matches
the DB and preserves the qualifier for the consumer's INDEX-DDL grant. The qualified
form is registered in testdata/upstream_extensions.jsonl with a tripwire; see
DEVIATIONS §1.16.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Bi9bXQhVpzEYuHoZrie9NF
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
MySQL
DROP INDEX idx ON tbldegraded to a rawCommand(the port had noexp.OnPropertynode for the ON-clause target), so the proxy-monster analyzer over-denied a legitimate table-DDL statement. This adds theOnPropertynode and parses the ON target as a table:DROP INDEX idx ON users→Drop{kind:INDEX, this:Table(idx), cluster:OnProperty(Table(users))}DROP INDEX idx ON db.users→… cluster:OnProperty(Table(users, schema:db))Two behaviors, one entry (DEVIATIONS §1.16):
Drop{cluster:OnProperty}; the port just lacked the node._parse_on_propertyparses only a single id, so it parse-errorsON db.usersat the dot — but real MySQL 8.0.46 accepts it (verified:DROP INDEX idx_email ON zzq.usersexecutes). Parsing a full table target matches the DB and preserves the qualifier for the consumer's grant. Registered intestdata/upstream_extensions.jsonl(mysql-drop-index-on-qualified) with a tripwire.Trap: the fix is scoped to
parseDrop— the sharedparseOnPropertyis left unchanged (itsON <id>→OnPropertyhalf is the ClickHouseON CLUSTERform, out of this port's base+MySQL+Postgres scope), soCREATE/ALTERare untouched. The OnProperty target is aTable(not upstream's bareIdentifier) so it can carry the db qualifier — an output-identical AST-shape difference for the unqualified form.Verification:
go test ./...green; mysql identity corpus 424→425; oracle-checked on MySQL 8.0.46. Reviewed by Codex + Sol (Grok's leg aborted on upstream API instability); Codex caught the db-qualified case, now fixed.🤖 Generated with Claude Code
https://claude.ai/code/session_01Bi9bXQhVpzEYuHoZrie9NF